Java Database Programming with JDBC Java Database Programming with JDBC
by Pratik Patel
Coriolis, The Coriolis Group
ISBN: 1576100561   Pub Date: 10/01/96
  

Table of Contents


Index


Note:  Page numbers in bold refer to program code listings.

Symbols

@ , 151
\ , 185
/* , 279
/**, 283
// , 282
% , 185
# , 151
_ , 185

A

acceptsURL method, 188, 264
Access95, 225
and Java applications, 31
ODBC datasources, 40
Access to databases
access control, 16
concurrent access, 222, 223
add method
DatabaseMetaData class, 204
Numeric class, 244
addIconRecord method, 118
allProceduresAreCallable method, 252
allTablesAreSelectable method, 252
ALTER clause, SQL, 22
Applets, Java
Bar Chart applet, 100
datasource connections, 56, 59
datasources, querying, 57, 96
design, 51–55
getData method, 97
IQ class, 51–59, 236
and JDBC-ODBC Bridge, 32, 67–68
Pie Chart applet, 104
security manager, Java interpreter, 144
structure, 47–49
trusted vs. untrusted, 67–68, 144
Web page certification, 144
Application servers, 223–224
ApplicationServer class, 225
Arithmetic operations, Numeric objects, 244–246
Arrays, Java language, 302–307
as keyword, 27

B

Bar Chart applet, 100
BIGINT data type (SQL), in JDBC, 159
Binary data types, 158
Binary Large Objects (BLOBs), 213
BINARY data type (SQL), in JDBC, 158
BIT data type (SQL), in JDBC, 159
Bitwise operations, Numeric objects, 246
BLOBs (Binary Large Objects), 213
boolean data type (Java), 159, 299
Borland International, Inc., 5
Bridge, JDBC to ODBC. See JDBC-ODBC Bridge.
Bridges, native, 164–171
buildCategory method, 116
BuildDB class, 115
buildIconStore method, 117
Bulletproof, 5
byte data type (Java), 88, 297

C

C Language
bridges, 164–171
Java-generated files, 166
JDBC bridge, 168
CallableStatement class, 248–250
ODBC calls, 81
OUT parameters, 248, 249
CallableStatement objects, 196
cancel method, 271
CardLayout objects, 131
Case sensitivity, 15
Catalog methods
getTables method, 201, 203–206
implementing, 199
results format, 204
Catalogs, 16
CGI scripts, security, 142
Certification, Web pages, 144
Chaining
SQLExceptions, 153
SQLWarnings, 154
char data type (Java), 299
CHAR data type (SQL), 21
JDBC representation, 158
Character data types, 158, 299–300
Character literals, Java language, 293–294
CHECK command (SQL), 20
Circular dependencies, 197–198
Class names, Java language, 288
Classes, JDBC. See JDBC classes.
Class.forName method, 36
CLASSPATH environment variable, 35
clearParameters method, 265
clearWarning method, 266
clearWarnings method
Connection class, 250
Statement class, 271
close method
Connection class, 250
ResultSet class, 267
Statement class, 271
ColorGenerator class, 108
Column metadata, SimpleText JDBC driver, 200
Columns, 14
adding, 23
data, retrieving, 214
deleting, 22
SimpleText JDBC driver, 151
SimpleTextColumn objects, adding, 204
Command-line arguments, Java language, 307–310
Comment styles, Java language, 279–285
Commerce API, Java, 143, 144
commit method, 250
Common Applications Environment, 183
CommonValue class, 178
Concurrent database access, 222, 223
connect method, 70, 193, 264
Connection class, 195–198, 250–252
createStatement method, 197
creating statements, 196–198
getTables method, 204
initialize method, 195
ODBC calls, 70
variables, 251
Connection objects
closing, 132
creating, 38
ConnectionWatcher class, 231
ConnectToDB method
example71 class, 101
example72 class, 105
Constructors
DataTruncation class, 273
Date class, 241
DriverPropertyInfo class, 243
Numeric class, 244
SQLException class, 273
SQLWarning class, 274
Time class, 247
TimeStamp class, 247
Types class, 248
copyFile method, 136
CREATE Command (SQL), 21
createFromByteArray method, 244
createFromIntegerArray method, 244
createFromRadixString method, 244
createFromScale method, 244
createStatement method, 197, 250
Cyber SQL Corporation, 5

D

-D command line option, 36
Data
charting, 99–109
deleting, 24
displaying, 95–109
inserting, 23, 152
null values, 216
retrieving, 26, 214
Data classes, JDBC, 160–164
Data coercion, 177–182
data type conversions, 184
CommonValue objects, 178, 215
Data Definition Language. See DDL.
Data Maintenance Language. See DML.
Data Query Language. See DQL.
Data transfer errors, debugging, 273
Data type conversions, JDBC drivers, 184
Data types
BIGINT (SQL), 159
BINARY (SQL), 158
binary, 158
BIT (SQL), 159
boolean (Java), 159, 299
byte (Java), 297
byte[ ], 88
CHAR (SQL), 21, 158
char (Java), 299
character, 158
data coercion, 177–182
DATE (SQL), 159
DECIMAL (SQL), 158
DOUBLE (SQL), 159
double (Java), 299
FLOAT (SQL), 159
float (Java), 298
floating point, 159
getTypeInfo method, 258
int (Java), 297
INTEGER (SQL), 159
Java language, 158–160, 296–300
JDBC, 157–164
JDBC drivers, 158
large data objects, 213
long (Java), 298
LONGVARBINARY (SQL), 88, 158
LONGVARCHAR (SQL), 158
NUMERIC (SQL), 158
REAL, (SQL), 159
short (Java), 297
SimpleText JDBC driver, 151
SMALLINT (SQL), 159
SQL, 158–60
string (Java class), 300
TIME (SQL), 159
TIMESTAMP (SQL), 159
time, 159
TINYINT (SQL), 159
Types class (JDBC), 157
VARBINARY (SQL), 88, 158
VARCHAR (SQL), 21, 158
Data validation
date values, 162
time values, 163
timestamp values, 164
Database access
access control, 16
concurrent access, 222, 223
Database Management Systems. See DBMS.
Database servers, 141–143, 223
Database vendors, endorsements of JDBC, 5
DatabaseMetaData class, 199–206, 252–264
add method, 204
catalog methods, implementing, 199
getNumericFunctions method, 73, 184
getSearchStringEscape method, 73, 185
getStringFunctions method, 73, 184
getSystemFunctions method, 73, 184
getTables method, 78, 201, 203–206
getTimeDateFunctions method, 73, 184
ODBC calls, 71–79
result format, 204
supportsConvert method, 73, 184
variables, 263
Databases. See also Datasources.
access issues, 16, 222
concurrency, 222–223
relational model, 14–19
dataDefinitionCausesTransactionCommit method, 252
dataDefinitionIgnoredInTransactions method, 252
DataRamp, 5
Datasources
Access95, 40
automatic commit, 250
Connection class, 195–198
connections, closing, 59, 132, 250
connections, opening, 56, 68, 121, 193
querying, 5759, 95–109
specifying, 37–38
DataTruncation class, 155–157, 273
Date class, 161, 241–242
valueOf method, 162
Date epoch, Java, 162
date escape clause, 183
Date functions, JDBC drivers, 184
DATE data type (SQL), in JDBC, 159
DBClient class, 233
DBMS (Database Management Systems)
drivers, 13–14
escape clauses, 182–186
JDBC compliance, 13–14
properties, retrieving, 190
Sybase, 209
DDL (Data Definition Language), 19–23
ALTER clause, 22
CHECK command, 20
CREATE command, 21
domains, 19
manipulating tables, 22–23
REFERENCES keyword, 22
Debugging. See also Tracing.
data transfer errors, 273
DECIMAL data type (SQL), in JDBC, 158
DELETE command (SQL), 24
deregisterDriver method, 242
destroy method, 48, 50
IQ class, 59
Dharma Systems, Inc., 5
displayIcon method, 132
divide method, 244
DML (Data Maintenance Language), 23–25
DELETE command, 24
INSERT command, 23
SET command, 25
UPDATE command, 24
WHERE clause, 24
Documentation, Java language, 283–286
doesMaxRowSizeIncludeBlobs method, 252
Domains, 19
double data type (Java), 299
DOUBLE data type (SQL), in JDBC, 159
doubleValue method, 245
DQL (Data Query Language), 25–28
Driver class, 186–195, 264
acceptsURL method, 188
connect method, 70, 193
constructor, 187
datasources, connecting to, 193
getPropertyInfo method, 70, 190, 192
ODBC calls, 70
URL processing, 187
Driver, SimpleText. See SimpleText JDBC driver.
DriverManager class, 152, 242–243
driver, selecting, 187
GetConnection method, 38, 69
println method, 175
setLogStream method, 70
tracing, 174
DriverManager object
JDBC drivers, registering, 36–37
sql.drivers property, 36
subprotocol, URL, 37
DriverPropertyInfo class, 243
Drivers, DBMS, JDBC compliance, 13–14
Drivers, JDBC. See JDBC drivers.

E

Encryption, 143
Enumeration objects, 125
equals method
Numeric class, 245
TimeStamp class, 247
Escape characters, LIKE predicate, 185
Escape clauses, 182–186
date, 183
LIKE predicate escape characters, 185
OUTER JOINS, 185
procedures, 185
scalar functions, 184–185
syntax, 183
time, 183
timestamp, 183
establishConnection method, 121
Event handling, 49–50, 5556
IconStore application, 131
example71 class, 100
example72 class, 104
Exceptions, JDBC
DataTruncation class, 155–157, 273
SQLException class, 152–153, 273–274
SQLWarning class, 153–155, 274
execute method
PreparedStatement class, 81, 210, 265
Statement class, 80, 208, 271
executeQuery method
PreparedStatement class, 210, 265
Statement class, 206, 271
executeUpdate method
PreparedStatement class, 210, 265
Statement class, 207, 271

F

fail method, 226
File formats, SimpleText JDBC driver, 151
findColumn method, 214, 267
float data type (Java), 298
FLOAT data type (SQL), in JDBC, 159
Floating point data types, 159
Java language, 298–299, 301
floatValue method, 245
Foreign keys, 18
getCrossReference method, 253
getExportedKeys method, 254

G

‘get’ methods, 214
getAsciiStream method, 267
getAutoClose method, 250
getAutoCommit method, 250
getBestRowIdentifier method, 252
getBinaryStream method, 267
getBoolean method, 267
getByte method, 267
getBytes method, 267
getCatalog method, 250
getCatalogName method, 270
getCatalogs method, 253
getCatalogSeparator method, 253
getCatalogTerm method, 253
getCategories method, 123
getColumnCount method, 270
getColumnDisplaySize method, 270
getColumnLabel method, 83, 217, 270
getColumnName method, 270
getColumnPrivileges method, 253
getColumns method, 253
getColumnType method, 270
getColumnTypeName method, 270
getConnection method, 38, 242
getCrossReference method, 253
getCursorName method, 267
getData method, 97, 102, 107
getDatabaseProductName method, 254
getDatabaseProductVersion method, 254
getDataSize method, 273
getDate method, 267
getDefaultTransactionIsolation method, 254
getDoublemethod, 268
getDriver method, 242
getDriverMajorVersion method, 254
getDriverMinorVersion method, 254
getDriverName method, 254
getDrivers method, 242
getDriverVersion method, 254
getErrorCode method, 274
getExportedKeys method, 254, 259
getExtraName Characters method, 254
getFloat method, 268
getIconDesc method, 125
getIdentifierQuoteString method, 255
getImportedKeys method, 255
getIndex method, 273
getIndexInfo method, 255
getInfo method, 230
getInt method, 268
getLoginTimeout method, 242
getLogStream method, 242
getLong method, 268
getMajorVersion method, 264
getMaxBinaryLiteralLength method, 255
getMaxCatalogNameLength method, 255
getMaxCharLiteralLength method, 255
getMaxColumnNameLength method, 255
getMaxColumnsInGroupBy method, 256
getMaxColumnsInIndex method, 256
getMaxColumnsInOrderBy method, 256
getMaxColumnsInSelect method, 256
getMaxColumnsInTable method, 256
getMaxConnections method, 256
getMaxCursorNameLength method, 256
getMaxFieldSize method, 272
getMaxIndexLength method, 256
getMaxProcedureNameLength method, 256
getMaxRows method, 272
getMaxRowSize method, 256
getMaxSchemaNameLength method, 256
getMaxStatementLength method, 256
getMaxStatements method, 256
getMaxTableNameLength method, 256
getMaxTablesInSelect method, 256
getMaxUserNameLength method, 256
getMetaData method
Connection class, 251
ResultSet class, 267
getMinorVersion method, 264
getMoreResults method, 80, 209, 272
getNanos method, 247
getNextException method, 274
getNextWarning method, 274
getNumeric method, 268
getNumericFunctions method, 73, 184, 257
getObject method
PreparedStatement class, 212
ResultSet class, 268
getParameter method, 273
getPrecision method, 270
getPrimaryKeys method, 257
getProcedure method, 257
getProcedureColumns method, 257
getProcedures method, 257
getPropertyInfo method, 70, 190, 192, 264
getQueryTimeout method, 272
getRead method, 273
getResultSet method, 209, 272
getRoundingValue method, 245
getScale method
Numeric class, 245
ResultSetMetaData class, 270
getScaled method, 245
getSchemaName method, 270
getSchemas method, 257
getSchemaTerm method, 257
getSearchStringEscape method, 73, 185, 257
getShort method, 268
getSQLKeywords method, 257
getSQLState method, 274
getString method, 81, 214, 215, 269
getStringFunctions method, 73, 184, 257
getSystemFunctions method, 73, 184, 257
getTableName method, 270
getTablePrivileges method, 258
getTables method
Connection class, 204
DatabaseMetaData class, 78, 201, 203–206, 258
getTableTypes method, 258
getTime method, 269
getTimeDateFunctions method, 73, 184, 258
getTimestamp method, 269
getTransactionIsolation method, 251
getTransferSize method, 273
getTypeInfo method, 258
getUnicodeStream method, 269
getUpdateCount method, 80, 209, 272
getURL method, 258
getUserName method, 258
getVersionColumns method, 258
getWarnings method
Connection class, 251
ResultSet class, 269
Statement class, 272
Grammar, SQL, SimpleText JDBC driver, 150
greaterThan method, 245
greaterThanOrEquals method, 245
GridBagLayout layout manager, 52–55
properties, 53, 54
Gupta Corporation, 5

H

handleEvent method, 49
IconStore class, 130
IQ class, 55, 237
hashCode method, 245
Hashtable objects, 125

I

IBM’s Database 2 (DB2), 5
ICONCATEGORY table, 113
IconStore application, 111–138
and CardLayout object, 131
BuildDB class, 115–119
event handling, 131
IconStore class, 119–137
images, displaying, 132, 134
images, saving, 135
images, storing, 119
lists, creating, 125
menus, creating, 124
IconStore class, 119
ICONSTORE table, 113
Identifiers, Java language, 286–289
Images
displaying, 132, 134
saving, 135
storing, 119
Imaginary (mSQL), 5
Informix Software, Inc., 5
init method, 48
example71 class, 100
example72 class, 105
IconStore class, 127
IQ class, 52, 236
initialize method, 195
Initialization of variables, Java language, 301–302
Input parameters, 210–13
InputStream objects
images, displaying, 134
processing, 213
INSERT command (SQL), 23
int data type (Java), 297
Integer data types, 159
Java language, 296–298
INTEGER data type (SQL), in JDBC, 159
integerDivide method, 245
Interfaces. See also JDBC interfaces.
and circular dependencies, 198
implementation, 171–173
JDBC, 186–217, 248–272
Intersoft, 5
Intersolv, 5
IQ class, 51, 236
isAutoIncrement method, 270
isCaseSensitive method, 270
isCatalogAtStart method, 258
isClosed method, 251
isCurrency method, 270
isDefinatelyWritable method, 270
isNullable method, 270
isProbablePrime method, 245
isReadOnly method
Connection class, 251
DatabaseMetaData class, 259
ResultSetMetaData class, 270
isSearchable method, 271
isSigned method, 271
isWritable method, 271

J

Java
applets. See Applets, Java.
compiler, 197
date epoch, 162
GridBagLayout layout manager, 52–55
interpreter, 144
language basics. See Java programming language.
security, 67–68, 143–144
Java Commerce API, 143, 144
Java programming language, 275–310
arrays, 302–307
character literals, 293–294
class names, 288
command-line arguments, 307–310
comment styles, 279–285
data types, 296–300
documentation, 283–285
identifiers, 285–289
JAVADOC program, 283–285
keywords, 289
lexical structure, 278–296
literals, 291–294
numeric literals, 291–293
operators, 294–296
separators, 296
variables, 300–302
Java Security API, 143, 144
Java Security Manager, 67, 144
java.sql.* package, 33, 36, 88
java.util.Properties object, 69
JAVADOC program, 283–286
JavaSoft, 214
JDBC
applet security, 144–145
architecture, 6
compliance, database drivers, 13–14
data types, 157–164
endorsements by database vendors, 5
logging facility, 70
overview, 4
JDBC API
installation, 33
interfaces. See JDBC interfaces.
java.sql.* package, 33
JDBC classes. See also JDBC interfaces.
data classes, 160–164
DataTruncation class, 155–157
Date class, 160, 161, 241–242
DriverManager class, 152, 242–243
DriverPropertyInfo class, 243
Numeric class, 160, 243–246
SQLException class, 152–153
SQLWarning class, 153–155
Time class, 162, 246–247
Timestamp class, 160, 163, 247
Types class, 157, 247–248
JDBC compliance, database drivers, 13–14
JDBC drivers
C language bridges, 164–171, 168
clean-up responsibilities, 132
Connection class, 195–198
data coercion, 215
data type conversions, 184
data types, 158
DatabaseMetaData class, 199–206
datasources, connecting to, 193
date functions, 184
Driver class, 186–195
and DriverManager, 152, 187
escape clauses, 182–186
explicit loading, 36
instantiation, 37
JDBC-ODBC Bridge, 63–84
loading, 187
native bridges, 164–171
numeric functions, 184
registering and calling, 36–37
SimpleText. See SimpleText JDBC driver.
sql.drivers property, 36
string functions, 184
subprotocol, URL, 37
system functions, 184
time functions, 184
tracing, 173–176
using, 29–41
JDBC exceptions, 152–157
DataTruncation class, 155–157, 273
SQLException class, 152–153, 273–274
SQLWarning class, 153–155, 274
JDBC interfaces, 171–173, 186–217, 248–272
CallableStatement class, 248–250
Connection class, 195–198, 250–252
DatabaseMetaData class, 199–206, 252–64
Driver class, 186–195, 264
PreparedStatement class, 209–213, 264–266
ResultSet class, 214–217, 266–269
ResultSetMetaData class, 217, 269–271
Statement class, 206–209, 271–272
JDBC specification, 13, 132, 171
jdbcCompliant method, 264
JDBC-ODBC bridge, 8, 63–84
installing, 38–39
legacy databases, 223
limitations, 66–68
and ODBC drivers, 67
required components, 38–39
security, 67–68
URLs supported, 68
JdbcOdbcDriver, 38

K

Keys, 17–19
foreign, 18
getCrossReference method, 253
getExportedKeys method, 254
getImportedKeys method, 255
getPrimaryKeys method, 257
primary, 18
Keywords, Java language, 289

L

Large data objects, 213
Legacy databases, 13, 223
lessThan method, 245
lessThanOrEquals method, 245
Lexical structure, Java language, 278–296
LIKE predicate escape characters, 185
Literals, Java language, 291–294
Logging facility, JDBC, 70
methods in DriverManager class, 242–243
long data type (Java), 298
longValue method, 245
LONGVARBINARY data type (SQL)
Java representation, 88
JDBC representation, 158
LONGVARCHAR data type (SQL), in JDBC, 158

M

Microsoft
Access95, 31, 40, 225
Windows95, 35, 39
Middleware, 221–224
modExp method, 245
modInverse, 245
Modular calculation methods, 245
multiply method, 245
Multidimensional arrays (Java), 306–307
Multiple results, SQL statements, 209

N

Native drivers, 164–171
nativeSQL method, 251
NetCharts library, 100
bar chart class, 102
next method, 269
NOT NULL directive, 21
Null values, 216
Numeric class, 160, 243–246
variables, 246
Numeric data types, 158
Java language, 297–299
Numeric functions, 184
Numeric literals, Java language, 292–293
NUMERIC data type (SQL), in JDBC, 158

O

Object Database Management Group, 92
Object Design, Inc., 5
Object Relation Model (ORM), 90–92
ODBC calls
CallableStatement class, 81
Connection class, 70
DatabaseMetaData class, 71–79
Driver class, 70
PreparedStatement class, 80
ResultSet class, 81
ResultSetMetaData class, 82
Statement class, 79
ODBC drivers, 8
and Java applets, 32
and JDBC Bridge, 67
setting up, 39–40
ODBC specification, 183
ODMG (Object Database Management Group), 92
Open Horizon, 5
OpenLink Software, 5
Operators, Java language, 294–296
Oracle Corporation, 5
ORDER BY SQL directive, 26
ORM (Object Relation Model), 90–92
OUT parameters, and CallableStatement class, 248, 249
OUTER JOINS, escape clauses, 185

P

Packet sniffing, 141
Parameter values, setting, 210–213
parse methods, 310
Performance, application servers, 224
Persistence Software, 5
pi method, 245
Pie Chart applet, 104
pow method, 246
prepareCall method, 251
PreparedStatement class, 209–213, 264–266
execute method, 81, 210
executeQuery method, 210
executeUpdate method, 210
getObject method, 212
ODBC calls, 80
parameter values, setting, 210–213
setBinaryStream method, 213
setObject method, 212
setString method, 211
verify method, 211
vs Statment class, 210
PreparedStatement objects, 196
prepareStatement method, 251
Presence Information Design, 5
Primary keys, 18
getImportedKeys method, 255
getPrimaryKeys method, 257
Prime number calculation methods, 245
println method, DriverManager class, 242
PRO-C, Inc., 5
Procedures, escape clauses, 185
ProcessCommand method, 234
Properties, DBMS, retrieving, 190
Properties objects, 38, 69
public methods, 171

Q

Queries, threaded, 271
Query results, 95–109, 248
displaying, 98–109
multiple, 209
storing in Java object, 96–98

R

random method, 246
Reader class, 234
REAL data type (SQL), in JDBC, 159
Recital Corporation, 5
REFERENCES keyword, 22
registerDriver method, 243
registerOutParameter method, 249, 250
Relational model, 14–19
remainder method, 246
ResultSet class, 89, 214–217, 266–269
findColumn method, 214
getString method, 81, 214, 215
ODBC calls, 81
verify method, 216
wasNull method, 216
ResultSetMetaData class, 90, 217, 269–271
getColumnLabel method, 83, 217
ODBC calls, 82
variables, 271
RogueWave Software, Inc., 5
rollback method, 251
Rounding, Numeric class, 160
Rows, 14
deleting, 24
inserting, 23
run method
ApplicationServer class, 227
ConnectionWatcher class, 231
Reader class, 234
ServerConnection class, 228
runQuery method, 230

S

SAS Institute, Inc., 5
.SBF (Simple Binary File) extension, 151
Scalar functions, escape clauses, 184–185
Schemas, 15
SCO, 5
.SDF (Simple Data File) extension, 151
Security, 141–145, 223
application servers, 224
CGI scripts, 142
database servers, 141–143
Java Commerce API, 143, 144
Java Security API, 143
JDBC applets, 144–145
JDBC drivers, 67–68
packet sniffing, 141
security manager, Java interpreter, 144
three-tier client/server systems, 143, 223
Web page certification, 144
Security API, Java, 143, 144
SELECT Command (SQL), 25
select method, 57
Separators, Java language, 296
ServerConnection class, 227
SET SQL command, 25
setAutoClose method, 251
setAutoCommit method, 251
setBinaryStream method, 213
setCatalog method, 251
setCursorName method, 272
setEscapeProcessing method, 272
setLoginTimeout method, 243
setLogStream method, 243
setMaxFieldSize method, 272
setMaxRows method, 272
setNanos method, 247
setNextException method, 274
setNextWarning method, 274
setObject method, 212
setQueryTimeout method, 272
setReadOnly method, 251
setRoundingValue method, 246
setScale method, 246
setString method, 211
setTransactionIsolation method, 251
shiftLeft method, 246
shiftRight method, 246
short data type (Java), 297
ShowChartData method
example71 class, 101
example72 class, 105
ShowFormattedData method
example71 class, 101
example72 class, 105
significantBits method, 246
SimpleText JDBC driver, 147–218
column metadata, representation, 200
CommonValue class, 178
Connection class, 195–198
data coercion, 215
data types, 151
DatabaseMetaData class, 199–206
Driver class, 186–195
file formats, 151
image data, storing, 119
input parameter values, 211
InputStream objects, processing, 213
inserting data, 152
MyBridge class, 165
PreparedStatement class, 209–213
ResultSet class, 214–217
ResultSetMetaData class, 217
SimpleTextColumn class, 200
SimpleTextInputStream class, 217
SimpleTextTable class, 205
specifications, 150–152
SQL grammar, 150
Statement class, 206–209
SimpleTextColumn class, 200
SimpleTextInputStream class, 217
SimpleTextTable class, 205
Simultaneous server connections, 223, 224
SMALLINT data type (SQL), in JDBC, 159
Specifications
JDBC, 13, 171
ODBC, 183
SimpleText JDBC driver, 150–152
SQL (Structured Query Language), 13–26.
See also SQL statements.
ALTER clause, 22
as keyword, 27
CHECK command, 20
CREATE command, 21
data types, 158–160, 258
DDL (Data Definition Language), 19–23
DELETE command, 24
DML (Data Maintenance Language), 23–25
domains, 19
DQL (Data Query Language), 25–28
escape clauses, 182–186
grammar, SimpleText JDBC driver, 150
INSERT command, 23
NOT NULL directive, 21
ORDER BY directive, 26
REFERENCES keyword, 22
SELECT command, 25
SET command, 25
string data types:, 21
syntax, 14
UPDATE command, 24
variables, 27
WHERE clause, 24
SQL Access Group, 183
SQL CAE (Common Applications Environment), 183
SQL statements. See also Query results.
creating, 196–198
executing, 206, 208
input parameters, 210–213
multiple results, 209
pre-compiled, 209
PreparedStatement class, 209
results, 208
Statement objects, 198
sql.drivers system property, 36
SQLException class, 152–153, 273–274
SQLException objects, tracing, 175
SQLWarning class, 153–155, 274
SQLWarning objects, 208
sqrt method, 246
start method, 48
Statement class, 206–209, 271–272
execute method, 80, 208
executeQuery method, 206
executeUpdate method, 207
getMoreResults method, 80, 209
getResultSet method, 209
getUpdateCount method, 80, 209
ODBC calls, 79
vs. PreparedStatment class, 210
Statement objects, 196, 198
and SQLWarning objects, 208
Statements, creating, 196–198
stop method, 48
String data types, SQL, 21
String functions, JDBC drivers, 184
string Java class, 300
Structured Query Language. See SQL.
Subname, URL, 68
Subprotocol, URL, 68
subtract method, 246
supportsConvert method, 73, 184
Sybase DBMS, 209
Sybase, Inc., 5
Symantec, 5
System functions, JDBC drivers, 184
System properties, 36

T

Tables, 14
creating, 20
and Java objects, 91
manipulating, 22–23
multiple, 18
target property, 50
Text files, SimpleText JDBC driver, 151
Threaded queries, 271
Three-tier client/server systems, 143, 221–224
Thunderstone, 6
Time class, 162, 246–247
toString method, 247
valueOf method, 163, 247
Time data types, 159
time escape clause, 183
Time functions, JDBC drivers, 184
TIME data type (SQL), in JDBC, 159
Timestamp class, 163, 247
valueOf method, 164
timestamp escape clause, 183
TIMESTAMP data type (SQL), in JDBC, 159
TINYINT data type (SQL), in JDBC, 159
toString method
Date class, 242
Numeric class, 246
Time class, 247
TimeStamp class, 247
traceOn method, 176
Tracing, 173–176
JDBC components, 175
traceOn method, 176
verifying, 175
Truncation of data, tracking, 155–157, 273
Type casting. See Data coercion.
Types class, 157, 247–248
variables, 248

U

Unix
JDBC API installation, 35
JDBC-ODBC Bridge installation, 39
UPDATE command, 24
URLs (Uniform Resource Locators), 37–38, 68

V

value method, 245
valueOf methods, 310
Date class, 162, 242
Time class, 163, 247
Timestamp class, 164, 247
VARBINARY data type (SQL)
Java representation, 88
JDBC representation, 158
VARCHAR data type (SQL), 21
JDBC representation, 158
Variables, Java language, 300–302
Vendors, database, JDBC endorsements, 5
verify method
PreparedStatement class, 211
ResultSet class, 216
Visigenic Software, Inc., 6

W

wasNull method, 216, 269
WebLogic, Inc., 6
Web page certification, 144
weightx, weighty properties, 53
WHERE SQL clause, 24
Whitespace, 14
Windows 95
JDBC API installation, 35
JDBC-ODBC Bridge, installation, 39

X

X/OPEN, 183
XDB Systems, Inc., 6


Table of Contents